﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LoveEatRabbit.Infrastructure.Interfaces
{
    /// <summary>
    /// 基础接口仓储
    /// </summary>
    /// <typeparam name="T">实体</typeparam>
    public interface IBaseRespository<T>
    {
        /// <summary>
        /// 查询方法
        /// </summary>
        /// <returns>返回任务</returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回任务</returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 修改方法
        /// </summary>
        /// <param name="t">实体</param>
        /// <returns>返回任务</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="items">参数</param>
        /// <returns>返回任务</returns>
        Task<int> AddRange(IEnumerable<T> items);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="items">参数</param>
        /// <returns>返回任务</returns>
        Task<int> UpdateRangeAsync(List<T> items);
    }
}
